<template>
	<view class="">
		<view class="mode">
			
			<view style="margin:0 auto 40rpx auto;width: 140rpx;">
					
				<u-image src="/static/addphone.png" width="140" height="60"></u-image>
				
		
					
			</view>
			
			<view class="">
				<u-input placeholder="请绑定手机号码" :disabled="disabled" input-align="center"  v-model="mobile"></u-input>
				<u-button :custom-style="{marginTop:'20rpx'}" type="success" @click="sumbit" v-if="mobile && !disabled">提交</u-button>
			</view>
			
			
			
		</view>
		
		<view class="mode" style="text-align: center;">
			<u-cell-item title="支付宝收款码" value="更改" :border-bottom="false" @click="change(2)"></u-cell-item>
		   
		   <view >
			   <view style="margin: 40rpx auto;width: 100rpx;">
			   	<u-image :src="logo" width="100" height="100"></u-image>
			   </view>
			   
			   <view style="color: #628DFF;">支付宝收款码</view>
		   </view>
			
		
		</view>
		
		<view class="mode" style="text-align: center;">
			<u-cell-item title="微信收款码" value="更改" :border-bottom="false" @click="change(1)"></u-cell-item>
		   
		   <view >
			   <view style="margin: 40rpx auto;width: 100rpx;">
			   	<u-image :src="logo1" width="100" height="100">
					
				</u-image>
			   </view>
			   
			   <view style="color: #628DFF;">微信收款码</view>
		   </view>
			
		
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
		    	disabled:false,
				logo:"/static/logo.png",
				logo1:"/static/logo.png",
				mobile:""
			}
		},
		methods:{
			change(item){		
			  uni.navigateTo({
			  	url:'../my/uptixian?id='+item
			  })
			},
			sumbit(){
				if(!this.$u.test.mobile(this.mobile)){
					this.$u.toast("请输入正确的手机号")
					return
				}
				this.$u.post('/api/user/saveInfo', {
					mobile:this.mobile
				}, {}).then(res => {
					
				   this.$u.toast("修改成功")
				}).catch(err => {})
			
			}
			
		},
		onLoad() {
		
		},
		onShow() {
			this.$u.post('/api/user/information', {
				
			}, {}).then(res => {
				var {alipayQr,mobile,wxQr}=res.data;
				this.logo=alipayQr;
				this.logo1=wxQr;
				this.mobile=mobile
				if(mobile){
					this.disabled=true
				}else{
					this.disabled=false
				}
			
			}).catch(err => {})
		}
	}
</script>

<style lang="scss">
@import  '../../pages/my/common.css';
.u-input__input{
	background: #F7F7F7;

}
</style>
